import 'package:flutter_test/flutter_test.dart';
import 'package:flutter_xprinter/connect_type.dart';
import 'package:flutter_xprinter/flutter_xprinter.dart';
import 'package:flutter_xprinter/flutter_xprinter_platform_interface.dart';
import 'package:flutter_xprinter/flutter_xprinter_method_channel.dart';
import 'package:plugin_platform_interface/plugin_platform_interface.dart';

class MockFlutterXprinterPlatform
    with MockPlatformInterfaceMixin
    implements FlutterXprinterPlatform {

  @override
  Future<String?> getPlatformVersion() => Future.value('42');

  @override
  void scanBluetoothDevices() {
    // TODO: implement navBTDevices
  }


  @override
  void addMethodCallHandler(CallHandler handler) {
    // TODO: implement addMethodCallHandler
  }

  @override
  void disconnect(String address) {
    // TODO: implement disconnect
  }

  @override
  Future<int> sendPrintTask(List<int> bytes, ConnectType connectType, DeviceType deviceType, String address) {
    // TODO: implement sendPrintTask
    throw UnimplementedError();
  }

  @override
  void connect(ConnectType connType, DeviceType deviceType, String address) {
    // TODO: implement connect
  }

  @override
  void scanUsbDevices() {
    // TODO: implement scanUsbDevices
    throw UnimplementedError();
  }

  @override
  void stopDiscovery() {
    // TODO: implement stopDiscovery
  }

}

void main() {
  final FlutterXprinterPlatform initialPlatform = FlutterXprinterPlatform.instance;

  test('$MethodChannelFlutterXprinter is the default instance', () {
    expect(initialPlatform, isInstanceOf<MethodChannelFlutterXprinter>());
  });

  test('getPlatformVersion', () async {
    FlutterXprinter flutterXprinterPlugin = FlutterXprinter();
    MockFlutterXprinterPlatform fakePlatform = MockFlutterXprinterPlatform();
    FlutterXprinterPlatform.instance = fakePlatform;

    expect(await flutterXprinterPlugin.getPlatformVersion(), '42');
  });
}
